package com.maltys.jedis.oper;

import com.maltys.jedis.utils.RedisClient;
import org.springframework.stereotype.Component;

import java.util.Set;
import java.util.UUID;

@Component
public class RedisOperation {

    public static String setRandomKey() {
        String set = RedisClient.getInstance().set("JEDIS-KEY" + UUID.randomUUID().toString().substring(0, 3),
                System.currentTimeMillis() + "");
        return set;
    }
    public static Set<String> getAllKeys() {
        return RedisClient.getInstance().keys("*");
    }

    public static String getKey(String key) {
        return RedisClient.getInstance().get(key);
    }
}
